import { getWithdrawalList } from '../../../../../common/api/index'
Page({
    data: {
		dataList: [],
		pageNo: 1,
		total: 0,
		showLoading: false,
    },
    onLoad(options) {
		this.getWithdrawalDatalist()
    },
    onShow() {

	},
	getWithdrawalDatalist(){
		this.setData({
			showLoading: true
		})
		let data = {
			pageNo: this.data.pageNo,
			pageSize: 10
		}
		getWithdrawalList(data).then(res => {
			if(res.code == 200){
				res.data.forEach(item => {
					if(item.state == 0){
						item.stateName = '待审核'
					}
					if(item.state == 1){
						item.stateName = '提现成功'
					}
					if(item.state == 2){
						item.stateName = '提现失败'
					}
				})
				let data = []
				if(this.data.pageNo == 1){
					data = res.data
				}else{
					data = this.data.dataList.concat(res.data)
				}
				this.setData({
					dataList: data,
					total: res.extend.total,
					showLoading: false
				})
			}
		})
	},
    onReachBottom() {
		if(this.data.total > this.data.dataList.length){
			this.setData({
				pageNo: ++this.data.pageNo,
			})
			this.getWithdrawalDatalist()
		}
    },










    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {

    }
})